<template>
  <div class="news-wrap">
    <div class="new-body">
      <div @click="$router.push({name: 'newsDetail', params: {id: item.id}})" v-for="(item, index) in newsList" :key="index" class="item-list">
        <div class="lefts"><img class="" :src="item.pic" alt=""></div>
        <div class="rights">
          <div class="right-bodys">
            <span class="titles">{{item.title}}</span>
            <span class="abouts">{{item.brief}}</span>
            <div class="counts">
              <i class="iconfont icon-yanjing1"></i>
              <span>{{item.visitsNumber}}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

</template>
<script>
import Api from '@/api/index.js'
export default {
  data() {
    return {
      newsList: [],
    }
  },
  methods: {
    getNewsAll() {
      Api.getNewsAll({page:1,pageSize:100}).then(res => {
        if (res.code === 20000) {
          this.newsList = res.data.array
        }
      })
    },
  },
  created() {
    this.getNewsAll();
  }
}
</script>
<style lang="less">
.new-body {
  width: 100%;
  .item-list {
    padding: 20/75rem 0;
    color: #666;
    display: flex;
    .lefts {
      margin-right: 20/75rem;
      img {
        width: 200/75rem;
        height: 150/75rem;
        border-radius: 5/75rem;
      }
    }
    .rights {
      flex: 1;
      width: 100%;
      overflow: hidden;
      .right-bodys {
        width: 100%;
        display: flex;
        flex-direction: column;
        .titles {
          height: 40/75rem;
          color: #333;
          width: 100%;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        .newline {
          line-height: 40/75rem;
          -webkit-box-orient: vertical;
          width: 100%;
        }
        .abouts {
          // h-70 newline c-999 line-2
          height: 70/75rem;
          color: #999;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
        }
        .counts {
          height: 40/75rem;
          color: #aaa;
          display: flex;
          justify-content: flex-end;
          margin-top: 10/75rem;
          align-items: center;
          span {
            margin-left: 10/75rem;
          }
        }
      }
    }
  }
}
.news-wrap {
  padding: 0 10px;
  .news-item {
    display: flex;
    margin-top: 15px;
    border-bottom: 1px solid #f2f2f2;
    border-top: 1px solid #fefefe;
    padding: 10px 0;
    .news-img-wrap {
      width: 2.8rem;
      height: 1.866667rem;
      border-radius: 0.053333rem;
      background-size: cover;
    }
    .news-info {
      height: 1.866667rem;
      margin-left: 10/75rem;
      display: flex;
      flex-direction: column;
      flex: 1;
      .news-title {
        font-size: 0.4rem;
        margin-bottom: 0.08rem;
        text-align: justify;
        width: 96%;
        color: #333;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .news-desc {
        font-size: 0.346667rem;
        line-height: 0.426667rem;
        flex: 1;
        text-align: justify;
        color: #999;
        margin-top: 0.15rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .news-view {
        text-align: right;
        color: #999;
        font-size: 12px;
      }
    }
  }
}
</style>
